<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>jb-aptech毕业设计项目</TITLE>
<meta name="renderer" content="ie-comp">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../css/style.css" rel="stylesheet" type="text/css">
<script src="../script/common.js"></script>
	<script src="../script/vue.js"></script>
	<script src="../script/jquery-3.3.1.min.js"></script>
</head>
<body>

<div id="app">
	<div class="page_title">数据字典管理</div>
	<div class="button_bar">
		<button class="common_button" onclick="help('');">帮助</button>
		<button class="common_button" onclick="location.href='dict_add.html'">新建</button>
		<button class="common_button" @click.prevent="load()">查询</button>
	</div>
	<table class="query_form_table">
		<tr>
			<th>类别</th>
			<td>
				<select v-model="basdict.dict_type">
				   <option value="">全部</option>
					<option v-for="d in basdicts">
						{{d.dict_type}}
					</option>
			   </select>
			</td>

			<th>条目</th>
			<td><input v-model="basdict.dict_item"/></td>
			<th>值</th>
			<td><input v-model="basdict.dict_value"/></td>
		</tr>
	</table>
	<br />
	<table class="data_list_table">
		<tr>
			<th>编号</th>
			<th>类别</th>
			<th>条目</th>
			<th>值</th>
			<th>是否可编辑</th>
			<th>操作</th>
		</tr>
		<tr v-for="d in basdicts">
			<td class="list_data_number" v-text="d.dict_id">1</td>
			<td class="list_data_ltext" v-text="d.dict_type">企业客户等级</td>
			<td class="list_data_text" v-text="d.dict_item">普通客户</td>
			<td class="list_data_text" v-text="d.dict_value">1</td>
			<td class="list_data_text" v-if="d.dict_is_editable == 0">否</td>
			<td class="list_data_text" v-if="d.dict_is_editable == 1">是</td>
			<td class="list_data_op" >　
			<img v-if="d.dict_is_editable ==1" onclick="to('dict_edit.html');" title="编辑" src="../images/bt_edit.gif" class="op_button" />
			<img @click="deldict(d.dict_id)" title="删除" src="../images/bt_del.gif" class="op_button" />
			</td>
		</tr>
		<tr>
			<th colspan="6" class="pager">
				<div class="pager">
					共<span v-text="pageInfo.total"></span>条记录 每页<input :value="pageInfo.pageSize" size="2" />条
					第<input :value="pageInfo.pageNum" size="2"/>页/共5页
					<a href="#">第一页</a>
					<a href="#" @click.prevent="load(pageInfo.pageNum-1)">上一页</a>
					<a href="#" @click.prevent="load(pageInfo.pageNum+1)">下一页</a>
					<a href="#">最后一页</a>
					转到<input value="1" size="2" />页
					<button width="20" onclick="reload();">GO</button>
				</div>
			</th>
		</tr>
	</table>
</div>
<script>
	const vm = new Vue({
		el:'#app',
		data:{
			basdicts:[],
			pageInfo:{},
			basdict:{
				dict_id:'',
				dict_type:'',
				dict_item:'',
				dict_value:'',
				dict_is_editable:'',
				pageNum:1,
				pageSize:10,
			},
			obj:{
				dict_id:'',
			}
		},methods:{
			load(num){
				this.basdict.pageNum=num
				$.getJSON("/BasDict/queryPage",this.basdict,json=>{
					console.log(JSON.stringify(json))
					this.basdicts = json.data.pageInfo.list;
					this.pageInfo =json.data.pageInfo;
				});
			},
			deldict(id){
				$.post("/BasDict/delById/"+this.obj,json=>{
					alert("删除成功");
				})
			}
		},mounted(){
			this.deldict();
			this.load();
		}
	})
</script>
</body>
</html>